package cn.tedu.csmall.stock.webapi.error;

import cn.tedu.csmall.commons.pojo.stock.dto.StockReduceCountDTO;
import cn.tedu.csmall.commons.restful.JsonResult;
import cn.tedu.csmall.commons.restful.ResponseCode;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;

//自定义限流类
@Slf4j
public class StockBlockError {
    //自定义限流方法
    //需要用static描述
    public static JsonResult blockError(StockReduceCountDTO stockReduceCountDTO,
                                        BlockException e){
        log.error("一个请求被限流了");
        return JsonResult.failed(ResponseCode.BAD_REQUEST,"服务器繁忙，请稍后重试");
    }
}
